package com.lb.exception;

import com.lb.common.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ResponseBody
@ControllerAdvice
public class GlobalExceptionHandler  {

    @ExceptionHandler(Exception.class)
    public Result handle(Exception e)
    {
        e.printStackTrace();
        return Result.error("ded");
    }

    @ExceptionHandler(LeaseException.class)
    public Result error(LeaseException e)
    {
         return Result.error(e.getMessage(),e.getCode());
    }
}
